The program calculates the prime numbers with the Sieve of Eratosthenes. And now im asking how could I improve the program ? Any modification would be welcome!! thanks a lot.
Code:#include <stdio.h> #include <stdlib.h> #define MAX 100 #define TRUE (1 == 1) #define FALSE (1 == 0) int main(int argc, char *argv[]){ int p [MAX]; int i, n, candidat; int divisible; p[0]=2; p[1]=3; n=2; candidat = p[n-1] + 2; while (n < MAX) { divisible = FALSE; for (i = 0; (i < n) && !divisible; i++) divisible = ((candidat % p[i]) == 0); candidat += 2; } for (i = 0; i < MAX; i++) printf("%6d ", p[i]); printf("\n\n"); system("PAUSE"); return 0; }